package vn.axonivy.vision.streams;

import java.util.ArrayList;
import java.util.List;

public class Counting {
	public static void main(String[] args) {
		/*
		 * Count is a terminal operation returning the number of elements in the
		 * stream as a long.
		 */
		List<String> memberNames = new ArrayList<>();
		memberNames.add("Amitabh");
		memberNames.add("Shekhar");
		memberNames.add("Aman");
		memberNames.add("Rahul");
		memberNames.add("Shahrukh");
		memberNames.add("Salman");
		memberNames.add("Yana");
		memberNames.add("Lokesh");

		long totalMatched = memberNames.stream()
				.filter((s) -> s.startsWith("A")).count();

		System.out.println("Count startsWith 'A': " + totalMatched);
	}
}
